|
|
|
| |
|
|
|
|
Database integrity and foreign keys are covered in depth on Day 16, ''Database Normalization," and Day 17, "Multiuser Considerations." |
|
|
|
|
|
|
|
|
|
|
Now that you've worked through the basics of database elements in general, let's look at specific characteristics of Visual Basic data fields. |
|
|
|
|
|
|
|
|
Visual Basic Database Field Types |
|
|
|
|
|
|
|
|
Visual Basic stores values in the data table in data fields. Visual Basic recognizes 14 different data field types that you can use to store values. Each data field type has unique qualities that make it especially suitable for storing different types of data. Some are used to store images, the results of checkbox fields, currency amounts, calendar dates, and various sizes of numeric values. Table 2.1 lists the 14 database field types recognized by Visual Basic. |
|
|
|
|
|
|
|
|
The first column contains the Visual Basic data field type name. This is the name you use when you create data tables using the Visual Data Manager from the Toolbar. You learn about using this tool in Day 7, "Using the Visdata Program." |
|
|
|
|
|
|
|
|
The second column shows the number of bytes of storage taken by the various data field types. If the size column is set to "V," the length is variable and is determined by you at design time or by the program at runtime. |
|
|
|
|
|
|
|
|
The third column in the table shows the equivalent Visual Basic data type for the associated database field type. This column tells you what Visual Basic data type you can use to update the database field. |
|
|
|
|
| Table 2.1. Visual Basic data field types. | | Data Field Type | Size | VBType | Comments | | BINARY | V | (none) | Limited to 255 bytes | | BOOLEAN | 1 | Boolean | Stores 0 or -1 only | | BYTE | 1 | Integer | Stores 0 to 255 only | | COUNTER | 8 | Long | Auto-incrementing Long type | | CURRENCY | 8 | Currency | 15 places to left of decimal, 4 to right | | DATETIME | 8 | Date/Time | Date stored on the left of decimal point, time stored on the right | | DOUBLE | 8 | Double |
|
|
|